<?php
if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}
//type 类型 帖子 1，文章 2，日志 3
if($_GET['alias']){
	$alias = $_GET['alias'];
	if(CHARSET=='gbk' || CHARSET=='big5'){
		if(function_exists('mb_convert_encoding')){
			$alias = mb_convert_encoding($alias,CHARSET,'utf-8');
			$alias = str_replace('?','',$alias);
		}elseif(CHARSET=='gbk'){
			$alias = iconv('utf-8',CHARSET,$alias);
		}
	}
	if(defined('MAGIC_QUOTES_GPC') && MAGIC_QUOTES_GPC == false){
		$alias = daddslashes($alias);
	}
}
if($_GET['mod']=='viewthread'){
	$ars = DB::fetch_first('SELECT * FROM '.DB::table('plugin_alias_bind').' WHERE type=1 and status=1 and alias=\''.$alias.'\'');
	if($ars && $ars['type']==1 && $ars['status']==1){$_GET['tid'] = $ars['rid'];}
	if($_G['setting']['version']=='X2'){
		$_G['gp_tid'] = $_GET['tid'];
	}
}else if($_GET['mod']=='tag'){
	$ars = DB::fetch_first('SELECT * FROM '.DB::table('common_tag').' WHERE tagname=\''.$alias.'\'');
	if($ars){$_GET['id'] = $ars['tagid'];}
}
?>